package com.mx.service;

import com.mx.config.DbContextHolder;
import com.mx.constant.DBTypeEnum;
import com.mx.entity.Order;
import com.mx.entity.User;
import com.mx.mapper.OrderMapper;
import com.mx.mapper.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author cyf
 * @description
 * @create 2018-11-21 18:39
 **/
@Service
public class TestService {
    private static final Logger log = LoggerFactory.getLogger(TestService.class);

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private OrderMapper orderMapper;

    public void testGet() {
        DbContextHolder.setDbType(DBTypeEnum.db1);
        User user = userMapper.selectById(1);
        log.info("user {}", user);

        DbContextHolder.setDbType(DBTypeEnum.db2);
        Order order = orderMapper.selectById(2);
        log.info("order {}", order);
    }


}
